package com.unbank.shuju.action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.PropertyConfigurator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

import com.unbank.bhi.BhiConsole;
import com.unbank.bhi.action.BhiLogin;
import com.unbank.bhi.dao.BhiJDBC;
import com.unbank.util.FinalWord;

public class Youxian_163 {

	private static Log log = LogFactory.getLog(Youxian_163.class);
	static {
		// 启动日志
		try {
			PropertyConfigurator.configure(Youxian_163.class.getClassLoader()
					.getResource("").toURI().getPath()
					+ FinalWord.LOGFILE);
			log.info("---日志系统启动成功---");
		} catch (Exception e) {
			log.error("日志系统启动失败:" + e);
		}
	}

	public static void main(String[] args) {
		console();

	}

	private static void console() {
		System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
		WebDriver driver = new ChromeDriver();
		driver.manage().window().maximize();
		login("8869207@163.com", "635725", driver);
		userConsole(driver);
		// BhiJDBC.close();
		driver.quit();

	}

	private static void userConsole(WebDriver driver) {
		// <div id="_mail_component_2_2"
		// class="js-component-component nui-tree-item-label nui-tree-item-label-selected"
		// tabindex="0" hidefocus="hidefocus" role="treeitem"
		// aria-checked="true"><span title="收件箱"
		// class="nui-tree-item-text">收件箱</span>&nbsp;<strong
		// class="nui-tree-item-count" id="_mail_tree_1_1count"></strong></div>
		// 登陆成功以后
		// aWelcomeInbox
		WebElement userElement = driver.findElement(By
				.id("_mail_component_2_2"));
		userElement.click();

		// <div id="1397442155751_ContentDiv" class="pX sv"
		// style="display:"><div
		// id="1397442155751_-3777367680000001397442155763" class="pL kg"
		// title="更早" aria-label="更早" tabindex="0"><span
		// class="hc">更早</span><span
		// class="nui-title-tips nui-txt-tips">(7)</span></div><div
		// class="oe nui-txt-flag0" tabindex="0"
		// id="1397442155751_303xtbBLxlaaFDGMtAQAAsGDiv1397442155765"
		// aria-label="2014年3月27日&nbsp;02:52&nbsp;(星期四)&nbsp;招商银行信用卡&nbsp;发来&nbsp;一封邮件，主题为：&nbsp;招商银行信用卡电子账单-10元抢兑最高价值4388元豪礼！"
		// sign="letter" href="javascript:void(0)"><div class="kd fF bH"><div
		// class="eT" sign="start"><div class="cP"
		// id="1397442155751_303xtbBLxlaaFDGMtAQAAsGDragDiv"><b
		// class="nui-ico nui-ico-drag"
		// id="1397442155751_303xtbBLxlaaFDGMtAQAAsGDragB"></b></div><span
		// aria-checked="false" sign="checkbox" class="nui-chk cs" title="选中此邮件"
		// role="checkbox" tabindex="0" aria-label="选中此邮件"><span
		// class="nui-chk-symbol"><b class="nui-ico nui-ico-checkbox"
		// id="1397442155751_303xtbBLxlaaFDGMtAQAAsGCheckboxB"></b></span></span><b
		// class="cQ nui-ico nui-ico-integrity" title="网易诚信邮件联盟认证邮件"
		// style="background-image:url(http://mimg.127.net/p/images/ibx/cx/cmbchina.gif)"
		// sign="logo" id="1397442155751_303xtbBLxlaaFDGMtAQAAsGLogoB"></b><div
		// class="cM" sign="start-from"><span id="_mail_userlabel_0_175"
		// class="nui-user bE" title="">招商银行信用卡</span></div><b
		// class="cR nui-ico nui-ico-flag  nui-ico-flag-0 " title="设为红旗"
		// id="1397442155751_303xtbBLxlaaFDGMtAQAAsGFlagB"
		// sign="flag"></b></div><div class="gp"
		// id="1397442155751_303xtbBLxlaaFDGMtAQAAsGMidDiv"><div
		// class="cq">招商银行信用卡电子账单-10元抢兑最高价值4388元豪礼！</div></div><div class="gq"
		// id="1397442155751_303xtbBLxlaaFDGMtAQAAsGEndDiv"><div class="dw"
		// title="2014年3月27日 02:52 (星期四)">3月27日</div><div class="nui-ico  cN"
		// title="" style="visibility:hidden"></div><div
		// id="_mail_button_23_186"
		// class="js-component-button nui-miniBtn nui-btn nui-btn-hasIcon nui-miniBtn-hasIcon cO"
		// title="选择邮件标签" role="button" tabindex="0"><span
		// class="nui-btn-icon"><b class="nui-ico nui-ico-dArr"></b></span><span
		// class="nui-btn-text"></span></div></div><div class="gr"
		// id="1397442155751_303xtbBLxlaaFDGMtAQAAsGTagDiv"></div></div></div><div
		// class="oe nui-txt-flag0" tabindex="0"
		// id="1397442155751_358xtbBZhkaFD-4jkPygAAsYDiv1397442155766"
		// aria-label="2014年2月26日&nbsp;22:15&nbsp;(星期三)&nbsp;招商银行信用卡&nbsp;发来&nbsp;一封邮件，主题为：&nbsp;招商银行信用卡电子账单-官方客户端用户专享，10元抢兑最高价值4388元豪礼！"
		// sign="letter" href="javascript:void(0)"><div class="kd fF bH"><div
		// class="eT" sign="start"><div class="cP"
		// id="1397442155751_358xtbBZhkaFD-4jkPygAAsYDragDiv"><b
		// class="nui-ico nui-ico-drag"
		// id="1397442155751_358xtbBZhkaFD-4jkPygAAsYDragB"></b></div><span
		// aria-checked="false" sign="checkbox" class="nui-chk cs" title="选中此邮件"
		// role="checkbox" tabindex="0" aria-label="选中此邮件"><span
		// class="nui-chk-symbol"><b class="nui-ico nui-ico-checkbox"
		// id="1397442155751_358xtbBZhkaFD-4jkPygAAsYCheckboxB"></b></span></span><b
		// class="cQ nui-ico nui-ico-integrity" title="网易诚信邮件联盟认证邮件"
		// style="background-image:url(http://mimg.127.net/p/images/ibx/cx/cmbchina.gif)"
		// sign="logo" id="1397442155751_358xtbBZhkaFD-4jkPygAAsYLogoB"></b><div
		// class="cM" sign="start-from"><span id="_mail_userlabel_1_176"
		// class="nui-user bE" title="">招商银行信用卡</span></div><b
		// class="cR nui-ico nui-ico-flag  nui-ico-flag-0 " title="设为红旗"
		// id="1397442155751_358xtbBZhkaFD-4jkPygAAsYFlagB"
		// sign="flag"></b></div><div class="gp"
		// id="1397442155751_358xtbBZhkaFD-4jkPygAAsYMidDiv"><div
		// class="cq">招商银行信用卡电子账单-官方客户端用户专享，10元抢兑最高价值4388元豪礼！</div></div><div
		// class="gq" id="1397442155751_358xtbBZhkaFD-4jkPygAAsYEndDiv"><div
		// class="dw" title="2014年2月26日 22:15 (星期三)">2月26日</div><div
		// class="nui-ico  cN" title="" style="visibility:hidden"></div><div
		// id="_mail_button_24_194"
		// class="js-component-button nui-miniBtn nui-btn nui-btn-hasIcon nui-miniBtn-hasIcon cO"
		// title="选择邮件标签" role="button" tabindex="0"><span
		// class="nui-btn-icon"><b class="nui-ico nui-ico-dArr"></b></span><span
		// class="nui-btn-text"></span></div></div><div class="gr"
		// id="1397442155751_358xtbBZhkaFD-4jkPygAAsYTagDiv"></div></div></div><div
		// class="oe nui-txt-flag0" tabindex="0"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwACs7Div1397442155767"
		// aria-label="2014年1月26日&nbsp;20:42&nbsp;(星期日)&nbsp;招商银行信用卡&nbsp;发来&nbsp;一封邮件，主题为：&nbsp;招商银行信用卡电子账单-10元风暴，千万件商品等您来抢！"
		// sign="letter" href="javascript:void(0)"><div class="kd fF bH"><div
		// class="eT" sign="start"><div class="cP"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwACs7DragDiv"><b
		// class="nui-ico nui-ico-drag"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwACs7DragB"></b></div><span
		// aria-checked="false" sign="checkbox" class="nui-chk cs" title="选中此邮件"
		// role="checkbox" tabindex="0" aria-label="选中此邮件"><span
		// class="nui-chk-symbol"><b class="nui-ico nui-ico-checkbox"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwACs7CheckboxB"></b></span></span><b
		// class="cQ nui-ico nui-ico-integrity" title="网易诚信邮件联盟认证邮件"
		// style="background-image:url(http://mimg.127.net/p/images/ibx/cx/cmbchina.gif)"
		// sign="logo" id="1397442155751_303xtbBLwYcaFDFVkBhwACs7LogoB"></b><div
		// class="cM" sign="start-from"><span id="_mail_userlabel_2_177"
		// class="nui-user bE" title="">招商银行信用卡</span></div><b
		// class="cR nui-ico nui-ico-flag  nui-ico-flag-0 " title="设为红旗"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwACs7FlagB"
		// sign="flag"></b></div><div class="gp"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwACs7MidDiv"><div
		// class="cq">招商银行信用卡电子账单-10元风暴，千万件商品等您来抢！</div></div><div class="gq"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwACs7EndDiv"><div class="dw"
		// title="2014年1月26日 20:42 (星期日)">1月26日</div><div class="nui-ico  cN"
		// title="" style="visibility:hidden"></div><div
		// id="_mail_button_26_198"
		// class="js-component-button nui-miniBtn nui-btn nui-btn-hasIcon nui-miniBtn-hasIcon cO"
		// title="选择邮件标签" role="button" tabindex="0"><span
		// class="nui-btn-icon"><b class="nui-ico nui-ico-dArr"></b></span><span
		// class="nui-btn-text"></span></div></div><div class="gr"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwACs7TagDiv"></div></div></div><div
		// class="oe nui-txt-flag0" tabindex="0"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwABs4Div1397442155769"
		// aria-label="2014年1月26日&nbsp;17:18&nbsp;(星期日)&nbsp;大街网&nbsp;发来&nbsp;一封邮件，主题为：&nbsp;你的公司福利这么高端大气，你朋友们知道么？"
		// sign="letter" href="javascript:void(0)"><div class="kd fF bH"><div
		// class="eT" sign="start"><div class="cP"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwABs4DragDiv"><b
		// class="nui-ico nui-ico-drag"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwABs4DragB"></b></div><span
		// aria-checked="false" sign="checkbox" class="nui-chk cs" title="选中此邮件"
		// role="checkbox" tabindex="0" aria-label="选中此邮件"><span
		// class="nui-chk-symbol"><b class="nui-ico nui-ico-checkbox"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwABs4CheckboxB"></b></span></span><b
		// class="cQ nui-ico nui-ico-read" title="已读" sign="logo"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwABs4LogoB"></b><div class="cM"
		// sign="start-from"><span id="_mail_userlabel_3_178"
		// class="nui-user bE" title="">大街网</span></div><b
		// class="cR nui-ico nui-ico-flag  nui-ico-flag-0 " title="设为红旗"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwABs4FlagB"
		// sign="flag"></b></div><div class="gp"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwABs4MidDiv"><div
		// class="cq">你的公司福利这么高端大气，你朋友们知道么？</div></div><div class="gq"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwABs4EndDiv"><div class="dw"
		// title="2014年1月26日 17:18 (星期日)">1月26日</div><div class="nui-ico  cN"
		// title="" style="visibility:hidden"></div><div
		// id="_mail_button_27_200"
		// class="js-component-button nui-miniBtn nui-btn nui-btn-hasIcon nui-miniBtn-hasIcon cO"
		// title="选择邮件标签" role="button" tabindex="0"><span
		// class="nui-btn-icon"><b class="nui-ico nui-ico-dArr"></b></span><span
		// class="nui-btn-text"></span></div></div><div class="gr"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwABs4TagDiv"></div></div></div><div
		// class="oe nui-txt-flag0" tabindex="0"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwAAs5Div1397442155769"
		// aria-label="2014年1月23日&nbsp;20:08&nbsp;(星期四)&nbsp;招商银行信用卡&nbsp;发来&nbsp;一封邮件，主题为：&nbsp;招商银行YOUNG卡-生日月2月双倍积分提醒"
		// sign="letter" href="javascript:void(0)"><div class="kd fF bH"><div
		// class="eT" sign="start"><div class="cP"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwAAs5DragDiv"><b
		// class="nui-ico nui-ico-drag"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwAAs5DragB"></b></div><span
		// aria-checked="false" sign="checkbox" class="nui-chk cs" title="选中此邮件"
		// role="checkbox" tabindex="0" aria-label="选中此邮件"><span
		// class="nui-chk-symbol"><b class="nui-ico nui-ico-checkbox"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwAAs5CheckboxB"></b></span></span><b
		// class="cQ nui-ico nui-ico-integrity" title="网易诚信邮件联盟认证邮件"
		// style="background-image:url(http://mimg.127.net/p/images/ibx/cx/cmbchina.gif)"
		// sign="logo" id="1397442155751_303xtbBLwYcaFDFVkBhwAAs5LogoB"></b><div
		// class="cM" sign="start-from"><span id="_mail_userlabel_4_179"
		// class="nui-user bE" title="">招商银行信用卡</span></div><b
		// class="cR nui-ico nui-ico-flag  nui-ico-flag-0 " title="设为红旗"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwAAs5FlagB"
		// sign="flag"></b></div><div class="gp"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwAAs5MidDiv"><div
		// class="cq">招商银行YOUNG卡-生日月2月双倍积分提醒</div></div><div class="gq"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwAAs5EndDiv"><div class="dw"
		// title="2014年1月23日 20:08 (星期四)">1月23日</div><div class="nui-ico  cN"
		// title="" style="visibility:hidden"></div><div
		// id="_mail_button_25_196"
		// class="js-component-button nui-miniBtn nui-btn nui-btn-hasIcon nui-miniBtn-hasIcon cO"
		// title="选择邮件标签" role="button" tabindex="0"><span
		// class="nui-btn-icon"><b class="nui-ico nui-ico-dArr"></b></span><span
		// class="nui-btn-text"></span></div></div><div class="gr"
		// id="1397442155751_303xtbBLwYcaFDFVkBhwAAs5TagDiv"></div></div></div><div
		// class="oe nui-txt-flag0" tabindex="0"
		// id="1397442155751_411tbiKRoWaFEAHDi60wAAsRDiv1397442155770"
		// aria-label="2014年1月17日&nbsp;19:08&nbsp;(星期五)&nbsp;网易邮件中心&nbsp;发来&nbsp;一封邮件，主题为：&nbsp;2014，我们一起守望春天，网易邮箱祝您新春快乐！"
		// sign="letter" href="javascript:void(0)"><div class="kd fF bH"><div
		// class="eT" sign="start"><div class="cP"
		// id="1397442155751_411tbiKRoWaFEAHDi60wAAsRDragDiv"><b
		// class="nui-ico nui-ico-drag"
		// id="1397442155751_411tbiKRoWaFEAHDi60wAAsRDragB"></b></div><span
		// aria-checked="false" sign="checkbox" class="nui-chk cs" title="选中此邮件"
		// role="checkbox" tabindex="0" aria-label="选中此邮件"><span
		// class="nui-chk-symbol"><b class="nui-ico nui-ico-checkbox"
		// id="1397442155751_411tbiKRoWaFEAHDi60wAAsRCheckboxB"></b></span></span><b
		// class="cQ nui-ico nui-ico-ntes" title="网易诚信邮件联盟认证邮件" sign="logo"
		// id="1397442155751_411tbiKRoWaFEAHDi60wAAsRLogoB"></b><div class="cM"
		// sign="start-from"><span id="_mail_userlabel_5_180"
		// class="nui-user bE" title="">网易邮件中心</span></div><b
		// class="cR nui-ico nui-ico-flag  nui-ico-flag-0 " title="设为红旗"
		// id="1397442155751_411tbiKRoWaFEAHDi60wAAsRFlagB"
		// sign="flag"></b></div><div class="gp"
		// id="1397442155751_411tbiKRoWaFEAHDi60wAAsRMidDiv"><div
		// class="cq">2014，我们一起守望春天，网易邮箱祝您新春快乐！</div></div><div class="gq"
		// id="1397442155751_411tbiKRoWaFEAHDi60wAAsREndDiv"><div class="dw"
		// title="2014年1月17日 19:08 (星期五)">1月17日</div><div class="nui-ico  cN"
		// title="" style="visibility:hidden"></div><div
		// id="_mail_button_28_202"
		// class="js-component-button nui-miniBtn nui-btn nui-btn-hasIcon nui-miniBtn-hasIcon cO"
		// title="选择邮件标签" role="button" tabindex="0"><span
		// class="nui-btn-icon"><b class="nui-ico nui-ico-dArr"></b></span><span
		// class="nui-btn-text"></span></div></div><div class="gr"
		// id="1397442155751_411tbiKRoWaFEAHDi60wAAsRTagDiv"></div></div></div><div
		// class="oe nui-txt-flag0" tabindex="0"
		// id="1397442155751_1801tbitAQBClDPl7mqgAAb5Div1397442155770"
		// aria-label="2014年1月10日&nbsp;07:02&nbsp;(星期五)&nbsp;网易电影票&nbsp;发来&nbsp;一封邮件，主题为：&nbsp;9元看3D大片《神偷奶爸2》，票价直降30，人人有份"
		// sign="letter" href="javascript:void(0)"><div class="kd fF bH"><div
		// class="eT" sign="start"><div class="cP"
		// id="1397442155751_1801tbitAQBClDPl7mqgAAb5DragDiv"><b
		// class="nui-ico nui-ico-drag"
		// id="1397442155751_1801tbitAQBClDPl7mqgAAb5DragB"></b></div><span
		// aria-checked="false" sign="checkbox" class="nui-chk cs" title="选中此邮件"
		// role="checkbox" tabindex="0" aria-label="选中此邮件"><span
		// class="nui-chk-symbol"><b class="nui-ico nui-ico-checkbox"
		// id="1397442155751_1801tbitAQBClDPl7mqgAAb5CheckboxB"></b></span></span><b
		// class="cQ nui-ico nui-ico-read" title="已读" sign="logo"
		// id="1397442155751_1801tbitAQBClDPl7mqgAAb5LogoB"></b><div class="cM"
		// sign="start-from"><span id="_mail_userlabel_6_181"
		// class="nui-user bE" title="">网易电影票</span></div><b
		// class="cR nui-ico nui-ico-flag  nui-ico-flag-0 " title="设为红旗"
		// id="1397442155751_1801tbitAQBClDPl7mqgAAb5FlagB"
		// sign="flag"></b></div><div class="gp"
		// id="1397442155751_1801tbitAQBClDPl7mqgAAb5MidDiv"><div
		// class="cq">9元看3D大片《神偷奶爸2》，票价直降30，人人有份</div></div><div class="gq"
		// id="1397442155751_1801tbitAQBClDPl7mqgAAb5EndDiv"><div class="dw"
		// title="2014年1月10日 07:02 (星期五)">1月10日</div><div class="nui-ico  cN"
		// title="" style="visibility:hidden"></div></div><div class="gr"
		// id="1397442155751_1801tbitAQBClDPl7mqgAAb5TagDiv"></div></div></div></div>
		
		
		
		
		

	}

	// 登陆163邮箱
	private static boolean login(String userName, String password,
			WebDriver driver) {
		driver.get("http://mail.163.com/");
		WebElement userElement = driver.findElement(By.id("idInput"));
		WebElement passwordElement = driver.findElement(By.id("pwdInput"));
		userElement.sendKeys(userName);
		passwordElement.sendKeys(password);
		WebElement loginElement = driver.findElement(By.id("loginBtn"));
		loginElement.click();
		return true;

	}
}
